Telegram Group & Telegram Channel
135. Sieve of Eratosthenes : An algorithm to generate all the prime numbers within an range.

#include <stdio.h>
#define size 1000

int main (void)
{
int n;
scanf("%d",&n);
int arr[size]={0};

for(int i=2;i*i<=n;i++)
{
for(int j=i;i*j<=n;j++)
{
arr[i*j]=1;
}
}
for(int i=2;i<=n;i++)
{
if(!arr[i])
printf("%d ",i);
}
return 0;
}
#program_by : @freakyLuffy



tg-me.com/C_Codings/196
Create:
Last Update:

135. Sieve of Eratosthenes : An algorithm to generate all the prime numbers within an range.

#include <stdio.h>
#define size 1000

int main (void)
{
int n;
scanf("%d",&n);
int arr[size]={0};

for(int i=2;i*i<=n;i++)
{
for(int j=i;i*j<=n;j++)
{
arr[i*j]=1;
}
}
for(int i=2;i<=n;i++)
{
if(!arr[i])
printf("%d ",i);
}
return 0;
}
#program_by : @freakyLuffy

BY C Language πŸ‘¨β€πŸ’»


Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283

Share with your friend now:
tg-me.com/C_Codings/196

View MORE
Open in Telegram


C Language ‍ Telegram | DID YOU KNOW?

Date: |

Dump Scam in Leaked Telegram Chat

A leaked Telegram discussion by 50 so-called crypto influencers has exposed the extraordinary steps they take in order to profit on the back off unsuspecting defi investors. According to a leaked screenshot of the chat, an elaborate plan to defraud defi investors using the worthless β€œ$Few” tokens had been hatched. $Few tokens would be airdropped to some of the influencers who in turn promoted these to unsuspecting followers on Twitter.

Start with a fresh view of investing strategy. The combination of risks and fads this quarter looks to be topping. That means the future is ready to move in.Likely, there will not be a wholesale shift. Company actions will aim to benefit from economic growth, inflationary pressures and a return of market-determined interest rates. In turn, all of that should drive the stock market and investment returns higher.

C Language ‍ from it


Telegram C Language πŸ‘¨β€πŸ’»
FROM USA